home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
ELECTRON
/
3442.ZIP
/
NETWORK.ZIP
/
NETWORK.DOC
< prev
next >
Wrap
Text File
|
1985-08-20
|
12KB
|
566 lines
NETWORK.BAS V1.0
AC ELECTRONIC CIRCUIT ANALYSIS PROGRAM
Configured for the IBM by: Bruce A. Trolli
2/24/85
1
1.0) GENERAL
NETWORK.BAS outputs the ac frequency reponse for a user
described electronic circuit. The circuit description is
prepared as an input text file containing a two line
specification for each element in the circuit. The
specification of each element requires the user to assign
node numbers to each node in the circuit. This method is
similar to many commercially available circuit analysis
programs.
When NETWORK.BAS is run, it builds a matrix from the
user's circuit description file and evaluates the output node
voltage at each frequency under the assumption that the input
node has a 1 volt signal with zero phase angle applied to it.
At run time the user may specify the frequencies to be
calculated as either a linearly or logarithmically spaced
interval. Output is sent to the screen by default but an
optional output datafile may be specified at runtime.
Models are provided for Resistors, Capacitors,
Inductors, Bipolar transistors (current controlled current
sources), Fets (voltage controlled current sources, and
Opamps (voltage controlled voltage sources).
2
2.0) ACKNOWLEDGEMENTS
Network.bas is an adaptation of an existing circuit
analysis program to run on the IBM PC. The origional
article: "Verify Network Frequency Response With This Simple
Basic Program", Werner A. Schnider, EDN magazine, October 5,
1977, was written for a Hewlett Packard 9830A desktop
calculator.
The program was modified to run on an Apple II and
reappeared in the magazine as: "Basic Program Performs
Circuit Analysis", Richard Steincross, EDN magazine,
September 1, 1982. This version expanded the capabilities of
the program by adding inductors to the network elements
supported. It also allowed the user to specify input and
output nodes at run time. After testing this program, I have
removed this feature because it did not produce reliable
output for a number of simple circuits.
3
3.0) REQUIREMENTS
NETWORK.BAS runs under IBM or Microsoft BASIC (not
BASICA). It does require a single disk drive. If your system
has enough memory to let BASIC max out its 64k program and
data space limitation, then NETWORK will be able to handle 40
nodes. If your system has less memory it will be necessary to
adjust the number of nodes ( Y in line 1200 of the program).
Because the program output has been limited to text, it
can run with either the monochrome or color adapter. The
input and output formats have purposely been kept simple to
allow most systems to run the program. (Besides, I have
enough problems making programs print the correct answer let
alone print it on a jazzed up screen.)
4
4.0) RUNNING THE PROGRAM
4.1) Number the nodes
To analyze your circuit, it will be necessary to number
the nodes on your schematic diagram. These node numbers will
be used to prepare a precise description of the circuit so
that NETWORK can construct the circuits network equations.
The input node must be node number 1 and the output
node must be the highest node in the circuit.
AC ground is node 0. The 1 volt input that is applied
to node number 1 is referenced to node 0.
4.2) Prepare Input File
Prepare a text file that contains a two line
description for each circuit element according to the
definitions below. Note that comments may be added after the
element type so that the origional reference designations of
your circuit's schematic may be retained as part of the input
file. This should make it easy to go back and forth between
your schematic and the input file.
Also comments may be added anywhere in the input file
by placing a ";" at the beginning of the line.
Resistors:
R
from node, to node, value (in ohms)
Example: A 1000 ohm resistor between nodes 1 and 2.
R
1,2,1000
Capacitors:
C
from node, to node,value(in micro farads)
Example: A 10 uf capacitor between nodes 3 and 6.
C
3,6,10
5
Inductors:
L
from node, to node, value (in henries)
Fets:
F
gate node, source node, drain node, transconductance
(amps/volt)
Example: A common source fet with 10 mmhos transconductance.
F
2,0,4,.01
Bipolar Transistors:
B
base node, emitter node, collector node, beta, b-e resistance
(ohms)
Example: Emitter follower with beta=100
B
3,4,0,100,.001
Op Amps:
O
+ in, - in, + out, - out, gain, output resistance (ohms)
Example: Voltage follower.
O
1,2,2,0,1000000,100
6
4.3) RUN THE NETWORK.BAS PROGRAM
The program will prompt for an input filename. It
assumes that your circuit desctription is contained in a file
with a .NET extension. If you can't remeber the name of the
circuit desctription file, hit the ENTER key and all
filenames with extensions .NET on the default disk will be
listed on the screen.
The program will tell you the number of nodes
actually found in the circuit description file and tell you
which nodes are being used as input and output nodes. At this
time verify these with your origional schematic to catch any
errors that you may have had in your input circuit
description.
The program will now ask for the name of the
optional output file that will be used to store the data from
the program. You can avoid creating the output file by mearly
hitting the ENTER key.
When the program asks for the frequency range to be
analyzed, either a linear increment (a positive number) or a
number of logarithmically space points (a negative number)
may be specified. If the logarithmic spacing is chosen, the
number entered is the total number of points to be calculated
over the entire frequency interval.
At the end of the analysis, the program will prompt for
a new frequency range. If you decline the opportunity to
recaclulate over a new range of frequencies, the program
terminates.
4.4) Cautions
Be aware that there are some common pitfalls that can
occurr with circuit simulation programs of this type. One
that frequently occurs is that where a dynamically unstable
circuit is modeled (your amplifier is really an oscillator).
Also be sure that there are some resistive elements in LC
circuits to prevent resonances from peaking into the
ionosphere. These are only common sense.
Always specify some resistance in the bipolar
transisitor and opamp models to prevent them from blowing the
program away.
7
5.0) SAMPLE CIRCUITS
Sample circuit description files have been included to
help you get the hang of setting up circuits. These are:
Sample1.net - A low pass RC filter circuit (1 hz cuttoff)
Sample1.net - A high pass RL filter circuit (1 hz cuttoff)
Sample3.net - A bandpass LC filter circuit (1 hz center)
Edntest.net - The test circuit from the origional EDN article
8
6.0) COMMENTS AND FEEDBACK
I would appreciate some feedback from anyone who uses
the program. I am planning to improve the program in the
future in the following areas:
- Provide a more general purpose analysis that lets
you pick inputs (multiple) and outputs (multiple)
independant of node numbering.
- Allow the output of one analysis to be fed into the input
of the next to get around the memory limitations.
- Add a plot routine (lin, log and semi log) to the program.
If anyone has a general purpose routine like this, I'd
like to hear from you. Most of the public domain stuff is
junk unfortunately.
- Run it through a compiler. Right now the circuits are
solved using Cramer's rule which stinks when it comes to
circuits above about 6 or 7 nodes. In general try to get
it to run faster.
Bruce Trolli
Cleveland RBBS
(216-3310510)
9
-3310510)